﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ActionPluginAPI;
using iMapa.Helper;

namespace VlcPlayerRemoteActionPlugin
{
    public class VlcPlayerActionParameters:ViewModelBase,IActionParameters
    {
        private string id;

        private string command;
        private string directory;
        private bool startVlcCommand;

        public VlcPlayerActionParameters()
        {
            this.id = this.GetHashCode().ToString();
        }

        public void PersistToFile(string filename)
        {
            ObjectXMLSerializer<VlcPlayerActionParameters>.Save(this, filename);
        }

        public string[] GetResourceFiles()
        {
            return null;
        }

        public void SetID(string value)
        {
            this.id = value;
        }

        public string GetID()
        {
            return id;
        }


        public string Command
        {
            get { return command; }
            set
            {
                command = value;
                onPropertyChanged("Command");
            }
        }

        public bool CommandEnabled
        {
            get { return !startVlcCommand; }
        }

        public bool StartCommand
        {
            get { return startVlcCommand; }
            set
            {
                startVlcCommand = value;
                onPropertyChanged("StartCommand");
                onPropertyChanged("CommandEnabled");
            }
        }


        public string Directory
        {
            get { return directory; }
            set { directory = value;
            onPropertyChanged("Directory");
            }
        }

        public static string Help
        {
            get { return   "| play . . . . . . . . . . . . . . . . . . play stream\n"+
                           "| stop . . . . . . . . . . . . . . . . . . stop stream\n"+
                           "| next . . . . . . . . . . . . . .  next playlist item\n"+
                           "| prev . . . . . . . . . . . .  previous playlist item\n"+
                           "| goto . . . . . . . . . . . . . .  goto item at index\n"+
                           "| repeat [on|off] . . . .  toggle playlist item repeat\n"+
                           "| loop [on|off] . . . . . . . . . toggle playlist loop\n"+
                           "| random [on|off] . . . . . . .  toggle random jumping\n"+
                           "| clear . . . . . . . . . . . . . . clear the playlist\n"+
                           "| status . . . . . . . . . . . current playlist status\n"+
                           "| title [X]  . . . . . . set/get title in current item\n"+
                           "| title_n  . . . . . . . .  next title in current item\n"+
                           "| title_p  . . . . . .  previous title in current item\n"+
                           "| chapter [X]  . . . . set/get chapter in current item\n"+
                           "| chapter_n  . . . . . .  next chapter in current item\n"+
                           "| chapter_p  . . . .  previous chapter in current item\n"+
                           "| seek X . . . seek in seconds, for instance (seek 12)\n"+
                           "| pause  . . . . . . . . . . . . . . . .  toggle pause\n"+
                           "| fastforward  . . . . . . . .  .  set to maximum rate\n"+
                           "| rewind  . . . . . . . . . . . .  set to minimum rate\n"+
                           "| faster . . . . . . . . . .  faster playing of stream\n"+
                           "| slower . . . . . . . . . .  slower playing of stream\n"+
                           "| normal . . . . . . . . . .  normal playing of stream\n"+
                           "| f [on|off] . . . . . . . . . . . . toggle fullscreen\n"+
                           "| volume [X] . . . . . . . . . .  set/get audio volume\n"+
                           "| volup [X]  . . . . . . .  raise audio volume X steps\n"+
                           "| voldown [X]  . . . . . .  lower audio volume X steps\n"+
                           "| adev [X] . . . . . . . . . . .  set/get audio device\n"+
                           "| achan [X]. . . . . . . . . .  set/get audio channels\n"+
                           "| atrack [X] . . . . . . . . . . . set/get audio track\n"+
                           "| vtrack [X] . . . . . . . . . . . set/get video track\n"+
                           "| vratio [X]  . . . . . . . set/get video aspect ratio\n"+
                           "| vcrop [X]  . . . . . . . . . . .  set/get video crop\n"+
                           "| vzoom [X]  . . . . . . . . . . .  set/get video zoom\n"+
                           "| snapshot . . . . . . . . . . . . take video snapshot\n"+
                           "| strack [X] . . . . . . . . . set/get subtitles track\n"+
                           "| key [hotkey name] . . . . . .  simulate hotkey press"; }
        }
    }
}
